commit: Fix segfault on async writes if object exists and checksum requested
authorColin Walters <walters@verbum.org>
Thu, 22 Jan 2015 02:16:11 +0000 (21:16 -0500)
committerColin Walters <walters@verbum.org>
Thu, 22 Jan 2015 02:17:47 +0000 (21:17 -0500)
If an object already existed and we somehow tried to pull it, the
caller would still expect a returned checksum.

This appears to happen with static deltas for some reason; we might be
including duplicate metadata objects.  Regardless, this is a bug that
should be fixed.

src/libostree/ostree-repo-commit.c

index ca52704efb535611f5d28c72c4e1135820213495..a149c2e0d1e797da83cc89d430a4ca544e811bd0 100644 (file)
@@ -478,6 +478,8 @@ write_object (OstreeRepo         *self,
         goto out;
       if (have_obj)
         {
+          if (out_csum)
+            *out_csum = ostree_checksum_to_bytes (expected_checksum);
           ret = TRUE;
           goto out;
         }